﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;
using Entities;

namespace BusinessLogicLayer
{
    public class ChiTietPhieuNhapBO
    {
        private ChiTietPhieuNhapDAL dal;
        public ChiTietPhieuNhapBO()
        {
            try
            {
                dal = new ChiTietPhieuNhapDAL();
            }
            catch (Exception e)
            {
                throw new BusinessLogicException();
            }
        }
        public int InsertChiTietPhieuNhap(ChiTietPhieuNhap ctpn)
        {
            int kq = 0;
            try
            {
                kq = dal.InsertChiTietPhieuNhap(ctpn);
            }
            catch (Exception)
            {
                return kq;
                throw;
            }
            return kq;
        }
        public int UpdateChiTietPhieuNhap(ChiTietPhieuNhap ctpn)
        {
            int kq = 0;
            try
            {
                kq = dal.UpdateChiTietPhieuNhap(ctpn);
            }
            catch (Exception)
            {
                return kq;
                throw;
            }
            return kq;
        }
        public int DeleteChiTietPhieuNhap(int maChiTietPhieuNhap)
        {
            int kq = 0;
            try
            {
                kq = dal.DeleteChiTietPhieuNhap(maChiTietPhieuNhap);
            }
            catch (Exception)
            {
                return kq;
                throw;
            }
            return kq;
        }
        public int GetTongSachNhapTrongThang(string thang, string nam, int maSach)
        {
            int kq = 0;
            try
            {
                kq = dal.GetTongSachNhapTrongThang(thang, nam, maSach);
            }
            catch (Exception)
            {
                return kq;
                throw;
            }
            return kq;
        }
    }
}
